package org.example.producer.controller;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.common.util.ResponseUtils;
import org.example.common.model.vo.TestVO;
import org.example.common.model.vo.base.ResponseVO;
import org.example.producer.service.TestService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author lsliang
 */
@Slf4j
@RequestMapping("/api/test")
@RestController
@AllArgsConstructor
public class TestController {

    private final TestService testServiceImpl;

    @PostMapping
    public ResponseVO<TestVO> addUser(@RequestBody @Validated TestVO testVO) {
        log.info("----------------request start----------------");
        testServiceImpl.addTest(testVO);
        log.info("----------------request end----------------");
        return ResponseUtils.success();
    }

    @GetMapping
    public ResponseVO test() {
        return ResponseUtils.success("hello world");
    }
}
